<template>
	<view>
		<scroll-view class="scroll-view" scroll-y="true" :style="'height:'+scriptHeight+'px'">
			<template v-if="article != ''">
			<view class="title">{{article.title}}</view>
			<view class="author">[{{article.dynasty}}] {{article.author}}</view>
			<view class="article-content">
				{{article.content}}
			</view>
			<view class="label">
				<text class="label-text" v-for="(item,index) in label" :key="index">{{item}}</text>
				
			</view>
			<!-- <view class="tool">
				<view class="share">
					<view class="tool-share"><image></image></view>
					<view class="tool-title"></view>
				</view>
				<view class="collect"></view>
			</view> -->
			<view class="note">
				<view class="note-title">译文</view>
				<view class="note-content">{{article.translate}}</view>
			</view>
			<view class="note">
				<view  class="note-title">注释</view>
				<view class="note-content">{{article.note}}</view>
			</view>
			<view style="height: 30px;"></view>
			</template>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				'id':0,
				'scriptHeight':400,
				'article':"",
				'label':[],
			}
		},
		onReady() {
			this.scriptHeight = uni.getSystemInfoSync().windowHeight;
		},
		onLoad(option) {
			this.id = option.id;
			let that = this;
			uni.request({
				url: that.websiteUrl+'/articlesc',
				method:'GET',
				header: {
				        'x-requested-with': 'xmlhttprequest' //自定义请求头信息
				    },
				data:{
					'id':that.id,
				},
				success:(res)=>{
					if(res.data.code != 1){
						uni.showToast({
							title:"网络错误！",
							duration:2000,
							icon:'none',
						})
					} else {
						that.article = res.data.data;
						
						that.label = that.article.labelArr;
						console.log(that.label);
					}
				}
			})
		},
		methods: {
			
		}
	}
</script>

<style lang="scss">
.scroll-view{
	// padding-top: 20px;
	height: 450px;
	background-color: $uni-scroll-bg-clolr;
	color:$uni-text-color;
	// padding-bottom: 20px;
	.title{
		font-size: 16px;
		font-weight: bold;
		display: flex;
		justify-content: center;
		align-items: center;
		height: 50px;
		color:$uni-text-color;
	}
	.author{
		display: flex;
		justify-content: center;
		align-items: center;
		height: 30px;
		font-size: 14px;
		color:$uni-text-color;
	}
	.article-content{
		display: flex;
		padding:10px 15px;
		color:$uni-text-color;
		font-size: 15px;
		line-height: 25px;
	}
	.label{
		display: flex;
		font-size: 13px;
		flex-wrap:wrap;
		margin-top: 10px;
		.label-text{
			display: flex;
			flex-direction: row;
			// border: 1px red solid;
			padding: 3px 5px;
			margin-left: 10px;
			margin-bottom: 10px;
			color:$uni-bg-color;
			border-radius: 5px;
			background-color: $uni-primary-color;
			
		}
	}
	.tool{
		
		.share{
			
		}
		.collect{
			
		}
	}
	.note{
		font-size: 14px;
		line-height: 25px;
		margin-left: 10px;
		margin-top: 10px;
		.note-title{
			font-size:15px;
			font-weight: bold;
			height:30px;
			line-height: 30px;
			color: $uni-text-color;
		}
		.note-content{
			
			text-indent:1em;
			color:$uni-text-color;
			line-height: 25px;
			margin: 0 10px;
		}
	}
}
</style>
